Ext.define('Admin.view.department.DepartmentGridPanel', {
    extend: 'Ext.grid.Panel',
    xtype: 'departmentGridPanel',
    id:'departmentGridPanel',
    requires: [
    	'Ext.grid.column.RowNumberer',
		'Ext.selection.CheckboxModel'
    	],
    title: '用户列表',
    selModel: {
         selType: 'checkboxmodel'
	 },
    //store: Ext.data.StoreManager.lookup('simpsonsStore'),
	bind: '{departmentDataList}',
	dockedItems: [{
        xtype: 'toolbar',
        items: [{
	        xtype: 'combobox',
	        fieldLabel: '',
	        name: 'searchFieldName',
			reference:'searchFieldName',
	        store: {
	            proxy: {
	                type: 'memory',
	                reader: 'array'
	            },
	            fields: [ 'key', 'value'],
	            data: [
	                ['名字', 'name'],
	                ['性质', 'nature']
	            ]
	        },
	        queryMode: 'local',
			displayField: 'key',
			valueField: 'value',
			value:'name',
	        allowBlank: false
	    },'-',{
            xtype: 'textfield',
            name:'searchFieldValue',
			reference:'searchFieldValue'
        },'-',{
            text:'快捷查询',
            tooltip:'快捷查询',
            iconCls:'x-fa fa-search',
            handler : 'search'
        }, '-',{
	            text: '批量删除',
	            listeners: {
				    click:'deleteDepartments'
				    }
			     },
				'-',{
	            text: '增加',
	            listeners: {
				    click:'openAddWindow'
			     	}
        	   }
        	
       	]
	}],

    columns: [
    	 { xtype: 'rownumberer',header: '序号',width: 80, sortable: false},
		 { header: 'ID',  dataIndex: 'id',hidden: true},
         { header: '名称',  dataIndex: 'name' ,width: 200},
         { header: '性质', dataIndex: 'nature', flex: 1 ,sortable: false,width: 400},
		 { header: '备注', dataIndex: 'remark' ,sortable: false ,width: 400},
		 	 
	   	 {
            xtype: 'actioncolumn',
            items: [{
                xtype: 'button',
                iconText:'增加',
                iconCls: 'x-fa fa-ban',
                handler : 'openAddWindow'
            },{
        		xtype: 'button',
                iconCls: 'x-fa fa-pencil',
                handler : 'openEditWindow'
            },{
                xtype: 'button',
                iconCls: 'x-fa fa-close',
                handler : 'deleteDepartment'
            }],
            cls: 'content-column',
            width: 120,
            //dataIndex: 'bool',
            text: '操作',
            tooltip: '操作 '
           }
    ],
	bbar: {
	    xtype: 'pagingtoolbar',//注意以后MVVM中使用新写法,不要使用Ext.create()
        //store: Ext.data.StoreManager.lookup('simpsonsStore'),
        bind: '{departmentDataList}',
        displayInfo: true,
        displayMsg: 'Displaying topics {0} - {1} of {2}',
        emptyMsg: "No topics to display",
    }
});